<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台注册页</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="/tpblog/public/static/admin/css/font.css">
    <link rel="stylesheet" href="/tpblog/public/static/admin/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="/tpblog/public/static/admin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/tpblog/public/static/admin/js/xadmin.js"></script>

</head>
<body class="login-bg">

<div class="login layui-anim layui-anim-up">
    <div class="message">后台管理注册</div>
    <div id="darkbannerwrap"></div>
    <form method="post" class="layui-form" >
        <input name="username" placeholder="请输入用户名"  type="text"  class="layui-input" >
        <hr class="hr15">
        <input name="password" placeholder="请输入密码"  type="password" class="layui-input">
        <hr class="hr15">
        <input name="nickname" placeholder="请输入昵称"  type="text" class="layui-input">
        <hr class="hr15">
        <input name="email" placeholder="请输入邮箱"  type="email" class="layui-input">
        <hr class="hr15">
        <input value="注册" id="register" style="width:100%;" type="submit">
        <hr class="hr20" >
        <div style="text-align: center;">
            <a href="{:url('admin/index/login')}">返回登录</a>
        </div>
    </form>
</div>

<script>
    $(function  () {
        $("#register").click(function () {
            $.ajax({
                url:"{:url('admin/index/register')}",
                type:"post",
                data:$('form').serialize(),
                dataType:'json',
                success:function (data) {
                    if(data.code==1){
                        layer.msg(data.msg,{
                            icon:6,
                            time:2000
                        },function () {
                            location.href=data.url;
                        })
                    }else{
                        layer.open({
                            title:'注册失败',
                            content:data.msg,
                            icon:5,
                            anim:6
                        })
                    }
                }
            });
            return false;
        });
    })
</script>
</body>
</html>